<template>
  <div style="width: 100%">
    <div id="deawer">
      <v-tableTitle :btnConfig="btnConfig"
                    @receive="receive"
                    @complete="complete"></v-tableTitle>
      <div class="detailBox">
        <v-detail ref="detail"></v-detail>
      </div>
      <div class="detailListBox">
        <v-detailList ref="detailList"></v-detailList>
      </div>
    </div>
  </div>

</template>

<script>
import baseMixin from "@/mixins/BaseMixin";
import skipMixin from "@/mixins/SkipMixin";
import config from "../Config";
import detail from "../details/Detail"
import detailList from "../detailsList/DetailList"
import tableTitle from "commons/TableTitle";

export default {
  name: "",
  mixins: [baseMixin, skipMixin, config],
  data () {
    return {};
  },
  created () {
  },
  computed: {
    btnConfig () {
      return [
        { label: this.$t('ex.receive'), certigier: !this.btnPermNameList.includes('WM06010601'), invalid: "receive" },
        { label: this.$t('ex.done'), certigier: !this.btnPermNameList.includes('WM06010602'), invalid: "complete" },
      ]
    }
  },
  methods: {
    //领取
    async receive () {
      let flag = this.$refs.detail.$children[0].$refs.input.submitForm("from");
      if (!flag) {
        return;
      } else {
        let params = {
          whseid: this.$store.state.wms,
          userid: this.$Cookies.get('user'),
          ...this.$refs.detail.$children[0].inputData
        }
        this.$api.post(`/receiveRtxpagermanager`, params).then(res => {
          
            this.$message.success(res.returnMgr)
          
        })
      }
    },
    //完成 
    async complete () {
      let flag = this.$refs.detail.$children[0].$refs.input.submitForm("from");
      if (!flag) {
        return;
      } else {
        let params = {
          whseid: this.$store.state.wms,
          userid: this.$Cookies.get('user'),
          ...this.$refs.detail.$children[0].inputData
        }
        this.$api.post(`/completeRtxpagermanager`, params).then(res => {
          
            this.$message.success(res.returnMgr)
          
        })
      }
    },

  },
  mounted () {
    // 
  },
  watch: {},
  components: {
    "v-detail": detail,
    "v-detailList": detailList,
    "v-tableTitle": tableTitle,
  }
}
</script>

<style scoped>
</style>
